//
//  zhViewController.m
//  gangquOASystem
//
//  Created by michael on 2018/11/15.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "zhViewController.h"
#import "qnViewController.h"
@interface zhViewController ()

@end

@implementation zhViewController

- (void)viewDidLoad {
    [super viewDidLoad];
        self.title = @"综合信息";
        self.view.backgroundColor = [UIColor colorWithHexString:@"f5f5f5"];
        _uparray = @[@"区内动态",@"统计月报",];
         _midarray = @[@"领导批示讲话",@"委领导工作安排",@"值班管理"];
   [self initview];
    // Do any additional setup after loading the view.
}
- (void)initview{
if(!_tableView){
 _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth,KScreenHeight-kTopHeight) style:UITableViewStylePlain];
//        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.bounces = NO;
_tableView.dataSource = self;
_tableView.delegate = self;
    self.tableView.backgroundColor = [UIColor colorWithHexString:@"f5f5f5"];
    UIView * footerView = [[UIView alloc] initWithFrame:CGRectZero];

    self.tableView.tableFooterView = footerView;
[self.view addSubview:_tableView];
}
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
      switch (section) {
        case 0:
            return 2;
            break;
              case 1:
            return 3;
            break;
      
        default:
            return 0;
            break;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 50;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

        UIView * bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
    bgView.backgroundColor = [UIColor colorWithHexString:@"f5f5f5"];
        return bgView;

}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
   
    return 15;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section ==0){
static NSString *CellIdentifier = @"ImageOnRightCell";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if (cell == nil) {
              cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
              cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
        }
cell.imageView.image = [UIImage imageNamed:_uparray[indexPath.row]];
cell.textLabel.text = _uparray[indexPath.row];
cell.textLabel.textColor = [UIColor colorWithHexString:@"484848"];
cell.textLabel.font = [UIFont systemFontOfSize: 14.0];

        return cell;
}else if (indexPath.section ==1) {
     static NSString *CellIdentifier1 = @"ImageOnRightCell1";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if (cell == nil) {
              cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
              cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
        }
cell.imageView.image = [UIImage imageNamed:_midarray[indexPath.row]];
cell.textLabel.text = _midarray[indexPath.row];
cell.textLabel.textColor = [UIColor colorWithHexString:@"484848"];
cell.textLabel.font = [UIFont systemFontOfSize: 14.0];

        return cell;
}
else  {
 static NSString *CelldownIdentifier = @"ImagedownRightCell";

 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CelldownIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if (cell == nil) {
              cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CelldownIdentifier];
              cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
        }
        if(indexPath.row ==1){
        
[cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, MAXFLOAT)];        }
cell.imageView.image = [UIImage imageNamed:_downarray[indexPath.row]];
cell.textLabel.text = _downarray[indexPath.row];
cell.textLabel.textColor = [UIColor colorWithHexString:@"484848"];
cell.textLabel.font = [UIFont systemFontOfSize: 14.0];

        return cell;

}

}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section ==0){
if (indexPath.row ==0){
qnViewController *vc = [[qnViewController alloc]init];
vc.titlename = _uparray[indexPath.row];
vc.url = KexchfrontlineURL;
vc.method = @"groupinformationPage";
[self.navigationController pushViewController:vc animated:YES];
}

if (indexPath.row ==1){
qnViewController *vc = [[qnViewController alloc]init];
vc.titlename = _uparray[indexPath.row];
vc.url = KexchfrontlineURL;
vc.method = @"frontlinePage";
[self.navigationController pushViewController:vc animated:YES];
}
}
if (indexPath.section ==1){
if (indexPath.row ==0){
qnViewController *vc = [[qnViewController alloc]init];
vc.titlename = _midarray[indexPath.row];
vc.url = KexchfrontlineURL;
vc.method = @"projectpromotionPage";
[self.navigationController pushViewController:vc animated:YES];
}

if (indexPath.row ==1){
qnViewController *vc = [[qnViewController alloc]init];
vc.titlename = _midarray[indexPath.row];
vc.url = KexchfrontlineURL;
vc.method = @"leaderlinePage";
[self.navigationController pushViewController:vc animated:YES];
}
if (indexPath.row ==2){
qnViewController *vc = [[qnViewController alloc]init];
vc.titlename = _midarray[indexPath.row];
vc.url = KexchfrontlineURL;
vc.method = @"dutylinePage";
[self.navigationController pushViewController:vc animated:YES];
}
}
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
